<!--
*Author：jxx
 *Contact：283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/application/appdemo/app_product.js此处编写
 -->
<template>
  <view-grid
    ref="grid"
    :columns="columns"
    :detail="detail"
    :editFormFields="editFormFields"
    :editFormOptions="editFormOptions"
    :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions"
    :table="table"
    :extend="extend"
  >
  </view-grid>
</template>
<script>
import extend from "@/extension/application/appdemo/app_product.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
  setup() {
    const table = ref({
      key: "Id",
      footer: "Foots",
      cnName: "产品列表",
      name: "appdemo/app_product",
      url: "/app_product/",
      sortName: "CreateDate",
    });
    const editFormFields = ref({
      Name: "",
      CategoeyId: "",
      Price: "",
      Enable: "",
      ColorIds: [],
      Pic: "",
      FileTest: "",
    });
    const editFormOptions = ref([
      [{ title: "产品名", field: "Name" }],
      [
        {
          dataKey: "产品类型",
          data: [],
          title: "分类",
          field: "CategoeyId",
          type: "select",
        },
      ],
      [{ title: "价格", field: "Price", type: "decimal" }],
      [
        {
          dataKey: "enable",
          data: [],
          title: "是否可用",
          field: "Enable",
          type: "switch",
        },
      ],
      [
        {
          dataKey: "colorsel",
          data: [],
          title: "颜色",
          field: "ColorIds",
          type: "selectList",
        },
      ],
      [{ title: "产品图", field: "Pic", type: "img" }],
      [{ title: "文件", field: "FileTest", type: "file" }],
    ]);
    const searchFormFields = ref({
      Name: "",
      CategoeyId: "",
      ColorIds: [],
      Enable: "",
    });
    const searchFormOptions = ref([
      [
        { title: "产品名", field: "Name", type: "like" },
        {
          dataKey: "产品类型",
          data: [],
          title: "分类",
          field: "CategoeyId",
          type: "select",
        },
        {
          dataKey: "enable",
          data: [],
          title: "是否可用",
          field: "Enable",
          type: "select",
        },
      ],
      [
        {
          dataKey: "colorsel",
          data: [],
          title: "颜色",
          field: "ColorIds",
          type: "selectList",
        },
      ],
    ]);
    const columns = ref([
      {
        field: "Id",
        title: "Id",
        type: "string",
        width: 110,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "Name",
        title: "产品名",
        type: "string",
        width: 220,
        align: "left",
        sort: true,
      },
      {
        field: "CategoeyId",
        title: "分类",
        type: "string",
        bind: { key: "产品类型", data: [] },
        width: 110,
        align: "left",
      },
      {
        field: "ColorIds",
        title: "颜色",
        type: "string",
        bind: { key: "colorsel", data: [] },
        width: 120,
        align: "left",
      },
      {
        field: "Price",
        title: "价格",
        type: "decimal",
        width: 110,
        align: "left",
      },
      {
        field: "CreateDate",
        title: "CreateDate",
        type: "datetime",
        width: 150,
        align: "left",
        sort: true,
      },
      {
        field: "CreateID",
        title: "CreateID",
        type: "int",
        width: 100,
        hidden: true,
        align: "left",
      },
      {
        field: "Creator",
        title: "Creator",
        type: "string",
        width: 100,
        align: "left",
      },
      {
        field: "Enable",
        title: "是否可用",
        type: "short",
        bind: { key: "enable", data: [] },
        width: 110,
        align: "left",
      },
      {
        field: "Modifier",
        title: "Modifier",
        type: "string",
        width: 100,
        hidden: true,
        align: "left",
      },
      {
        field: "ModifyDate",
        title: "ModifyDate",
        type: "datetime",
        width: 150,
        hidden: true,
        align: "left",
        sort: true,
      },
      {
        field: "ModifyID",
        title: "ModifyID",
        type: "int",
        width: 100,
        hidden: true,
        align: "left",
      },
      { field: "Pic", title: "产品图", type: "img", width: 120, align: "left" },
      {
        field: "FileTest",
        title: "文件",
        type: "file",
        width: 120,
        align: "left",
      },
    ]);
    const detail = ref({
      cnName: "#detailCnName",
      table: "#detailTable",
      columns: [],
      sortName: "",
      key: "",
    });
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
    };
  },
});
</script>
